import request from '@/lib/http/request'

const url_prefix = ''
const apis =
{
    getVrJs:function(){
        return request({
            url: '/html/vrJs.html',
            method: 'get'
        })
    },
    getVrHtml:function(){
        return request({
            url: '/html/h5.html',
            method: 'get'
        })
    },
    getCategory: function (id = 0) {
        if (id <= 0) {
            return request({
                url: url_prefix + "/api/categorys/",
                method: 'get'
            })
        }
        else {
            return request({
                url: url_prefix + "/api/categorys/" + id+'/',
                method: 'get'
            })
        }
    },
    getMovieList: function (page, query_params) {
        //var m_url = url_prefix + "/api/movies?page=" + page
        var m_url= url_prefix + '/api/apiMovies?page=' +page
        if (query_params.movie_category > 0) {
            m_url += '&category_id=' + query_params.movie_category
        } else {
            if (query_params.movie_name != null) {
                m_url += '&name=' + query_params.movie_name
            }
        }
        return request({
            url: m_url,
            method: 'get'
        })
    },
    getMovieDetail: function (id) {
        return request({
            url: url_prefix + "/api/movies/" + id,
            method: 'get'
        })
    },
    getPlayList: function (id) {
        return request({
            url: url_prefix + "/api/uris?movie_id=" + id,
            method: 'get'
        })
    },
    /*获取M3U8播放地址, 某些资源播放地址指向一个播放页面*/
    getM3U8File: function (url) {
        return request({
            url: url_prefix + "/api/m3u8?p_url=" + url,
            method: 'get'
        })
    },
    /*根据名称搜索激活采集*/
    spiderByName: function(url){
        return request({
            url: url_prefix + "/api/spiderByName?key="+ url,
            method:'get'
        })
    }
}

export default apis